from django.db import models


# Create your models here.
class PurchaseLog(models.Model):
    id = models.AutoField(primary_key=True)
    request_user = models.ForeignKey('custom_user.CustomUser',
                                     related_name='request_user',
                                     on_delete=models.CASCADE,
                                     help_text='申请人')
    approve_user = models.ForeignKey('custom_user.CustomUser',
                                     related_name='approve_user',
                                     on_delete=models.CASCADE,
                                     help_text='审批人')
    name = models.CharField(max_length=100, help_text='资产名称')
    create_date = models.DateField(help_text='申请日期')
    count = models.IntegerField(help_text='数量')
    price_per = models.IntegerField(null=True, help_text='单价')
    reason = models.CharField(max_length=512)
    def __str__(self):
        return self.name
    class Meta:
        verbose_name = '购买'
        verbose_name_plural = '购买清单'